//处理错误问题
export const errorMiddleware =(err,req,res,next) =>{
    if(err){
        const {name,code} =err;
        let msg= ""
        if(name == "MongoServerError"){
            if(code === 11000){
                msg = "值重复"
            }
        }
        console.log(err)
        
        res.json({code:1,msg})
    }
    next()
}




